72 #define TIMER_PERIOD 80
77 WDT_A_hold(WDT_A_BASE);
85 GPIO_setAsPeripheralModuleFunctionInputPin(
88 GPIO_TERNARY_MODULE_FUNCTION);
117 ADC10_B_init(ADC10_B_BASE,
118 ADC10_B_SAMPLEHOLDSOURCE_SC,
119 ADC10_B_CLOCKSOURCE_ADC10OSC,
120 ADC10_B_CLOCKDIVIDER_1);
122 ADC10_B_enable(ADC10_B_BASE);
129 ADC10_B_setupSamplingTimer(ADC10_B_BASE,
130 ADC10_B_CYCLEHOLD_16_CYCLES,
131 ADC10_B_MULTIPLESAMPLESDISABLE);
140 ADC10_B_configureMemory(ADC10_B_BASE,
143 ADC10_B_VREFNEG_AVSS);
145 ADC10_B_clearInterrupt(ADC10_B_BASE,
148 ADC10_B_enableInterrupt(ADC10_B_BASE,
153 while ( REF_BUSY == Ref_isRefGenBusy(REF_BASE) ) ;
156 Ref_setReferenceVoltage(REF_BASE,
159 Ref_enableReferenceVoltage(REF_BASE);
162 Timer_A_initUpModeParam initUpParam = {0};
163 initUpParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;
164 initUpParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;
166 initUpParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;
167 initUpParam.captureCompareInterruptEnable_CCR0_CCIE =
168 TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE;
169 initUpParam.timerClear = TIMER_A_DO_CLEAR;
170 initUpParam.startTimer =
true;
171 Timer_A_initUpMode(TIMER_A1_BASE, &initUpParam);
173 __bis_SR_register(CPUOFF + GIE);
184 ADC10_B_startConversion(ADC10_B_BASE,
185 ADC10_B_SINGLECHANNEL);
188 __bis_SR_register(CPUOFF + GIE);
197 #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
198 #pragma vector=ADC10_VECTOR
200 #elif defined(__GNUC__)
201 __attribute__((interrupt(ADC10_VECTOR)))
205 switch (__even_in_range(ADC10IV,12)){
216 if (ADC10_B_getResults(ADC10_B_BASE) < 0x155){
270 #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
271 #pragma vector=TIMER0_A0_VECTOR
273 #elif defined(__GNUC__)
274 __attribute__((interrupt(TIMER0_A0_VECTOR)))
__bic_SR_register_on_exit(LPM3_bits|GIE)
GPIO_setOutputHighOnPin(GPIO_PORT_LED1|GPIO_PORT_LED2, GPIO_PIN_LED1|GPIO_PIN_LED2)
GPIO_setOutputLowOnPin(GPIO_PORT_LED1|GPIO_PORT_LED2, GPIO_PIN_LED1|GPIO_PIN_LED2)